<?php

namespace app\serversetting\service\setting;
use app\manage\service\ApiBase;


class SettingCategory extends ApiBase
{
	
	protected $settingCategoryLogic = 'app\serversetting\logic\SettingCategory';
    protected $settingCategoryValidate = 'app\serversetting\validate\SettingCategory';
    
    
    /*为某应用添加一个分类*/
    public function addCategory(): array 
    {
        $data = $this->issetReceiveData(['app_id'=>0,'other_app_read'=>'','is_public'=>' ','pid'=>0,'name'=>' ','action'=>' ','order'=>100]);
        return $this->oneStepRun($data, 'serversetting/setting/SettingCategory/addCategory', 'addCategory');
    }

    /*编辑一个分类*/
    public function editCategory(): array 
    {
        $data = $this->issetReceiveData(['token'=>' ','other_app_read'=>'','is_public'=>' ','id'=>0,'name'=>' ','action'=>'','order'=>100]);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/editCategory', 'editCategory', 'editCategory');
    }

    /*获取分类树*/
    public function getTree(): array 
    {
        $data = $this->haveIssetReceiveData(['token'=>' ','id'=>0]);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/getTree', 'getTree', 'getTree');
    }

    /*查看某个分类详情*/
    public function oneCateInfo(): array 
    {
        $data = $this->receiveData(['id'=>0,'token'=>' ']);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/oneCateInfo', 'oneCateInfo', 'oneCateInfo');
    }

    /*删除某个分类*/
    public function delOneCate(): array 
    {
        $data = $this->receiveData(['id'=>0, 'token'=>' ']);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/delOneCate', 'delOneCate', 'delOneCate');
    }

    /*批量删除选中的分类*/
    public function batchDelCate(): array 
    {
        $data = $this->receiveData(['id'=>[], 'token'=>' ']);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/batchDelCate', 'batchDelCate', 'batchDelCate');
    }

    /*启用/禁用 一个 分类*/
    public function changeStatus(): array 
    {
        $data = $this->receiveData(['id'=>0,'status'=>' ', 'token'=>' ']);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/changeStatus', 'changeStatus', 'changeStatus');
    }

    /*启用/禁用 多个 分类*/
    public function batchChangeStatus(): array 
    {
        $data = $this->receiveData(['id'=>[],'status'=>' ', 'token'=>' ']);
        return $this->stepRun($data, 'serversetting/setting/SettingCategory/batchChangeStatus', 'batchChangeStatus', 'batchChangeStatus');
    }

}






